#pragma once

#include "NodeMap.h"
#include <vector>
#include "Utils.h"
#include "NodeMap.h"

// Agent speed
#define PPS 30 // 15 pixels per second 

// Drawing-specific constants
#define RAND_COLOR          CAgentUtils::Random(0, 255)
#define DRAW_RADIUS         2
#define ECOLOR_CAR_FILL     RGB(0, 128, 128)
#define ECOLOR_CAR_STROKE   RGB(0, 0, 0)
#define ECOLOR_TAXI_FILL    RGB(0, 128, 128)
#define ECOLOR_TAXI_STROKE  RGB(0, 0, 0)

// Enums
typedef enum AgentStatus_enum
{
    ESTATUS_NULL,               // Undefined status, typically invalid
    ESTATUS_STOPPED,            // Stopped (at a light, parked, traffic)
    ESTATUS_TRANSIT             // In transit to m_node
}
EAgentStatus;

typedef enum AgentType_enum
{
    ETYPE_CAR, ETYPE_TAXI
}
EAgentType;

// Forward declaration of CEnv class
class CEnv;

class CAgent
{
public:

    // Construction / destruction
    CAgent(int id, EAgentType type, CNode* node);
    virtual ~CAgent(void);
    
    virtual bool Step(CEnv* env, int ms);
    void Paint(CPaintDC& dc);

    int GetId();
    EAgentType GetType();
    EAgentStatus GetStatus();
    CString GetTypeString();
    CString GetStatusString();
    int GetStepCount();

protected:

    CNode* m_node;
    CNode* m_next;
    CPoint m_pt;
    EAgentStatus m_status;
    CSysTime m_action;
    int m_bmp;

private:    

    int m_id;
    int m_steps;
    EAgentType m_type;
    COLORREF GetStroke();
    COLORREF GetFill();
    void DrawPathLine(CNode* n1, CNode* n2, CPaintDC& dc);
};

typedef std::vector<CAgent*>        CAgentPtrVec;
typedef CAgentPtrVec::iterator         CAgentPtrVecIter;
typedef CAgentPtrVec::const_iterator   CAgentPtrVecCIter;
